package com.world.business.user.enums;

import com.world.common.exception.BusinessException;

/**
 * 功夫水平枚举
 *
 * @author WangYX
 * @version 1.0.0
 * @date 2023/09/06 11:12
 */
public enum UserKungFuLevelEnum {

    /**
     * 入门
     */
    RU_MEN(0, "入门"),

    /**
     * 掌握
     */
    ZHANG_WO(1, "掌握"),

    /**
     * 熟练
     */
    SHU_LIAN(2, "熟练"),

    /**
     * 精通
     */
    JING_TONG(3, "精通"),

    /**
     * 大成
     */
    DA_CHENG(4, "大成"),
    ;

    /**
     * 水平
     */
    private Integer level;

    /**
     * 水平名称
     */
    private String name;

    UserKungFuLevelEnum(Integer level, String name) {
        this.level = level;
        this.name = name;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String of(Integer level) {
        if (level.equals(RU_MEN.level)) {
            return RU_MEN.name;
        } else if (level.equals(ZHANG_WO.level)) {
            return ZHANG_WO.name;
        } else if (level.equals(SHU_LIAN.level)) {
            return SHU_LIAN.name;
        } else if (level.equals(JING_TONG.level)) {
            return JING_TONG.name;
        } else if (level.equals(DA_CHENG.level)) {
            return DA_CHENG.name;
        } else {
            throw new BusinessException("数据不存在！");
        }
    }


}
